import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import LoginPage from './components/login_page'; // 登录页面  
import NavPage from './components/nav_page'; // 导航页面  
import ProtectedRoute from './components/protected_route'; // 导入 ProtectedRoute  

const App: React.FC = () => {
  return (
    <Router
      future={{
        v7_startTransition: true, // 启用 startTransition 优化
        v7_relativeSplatPath: true, // 启用相对路径解析的新行为
      }}
    >
      <Routes>
        <Route path="/" element={<LoginPage />} />
        <Route
          path="/*"
          element={
            <ProtectedRoute element={<NavPage />} /> // 使用 ProtectedRoute 保护 NavPage  
          }
        />
      </Routes>
    </Router>
  );
};

export default App;